<?php

include_once 'Controller.php';
include_once 'models/Article.php';

class Article extends Controller {
  
  public function Article($attr=null){ 
    parent::__construct($attr);
    $this->model = new Article_($attr);
     $this->fe = new FormElements();
  }
  
  public function add(){
  	$this->checkInput('body',array(10,400));
    if($this->getAttribute('article_title') != null) {
      $this->set(array('title'=>$this->getAttribute('article_title'),'article_title'=>null));
      $this->checkInput('title',array(10,400));
    }
    if ($this->fe->areThereErrors())
      throw new MTException('INPUT ERROR');
    return parent::add();
  }
  
  public function checkInput($name,$min_max=false,$html_specials=false,$regex=false,$replaceSpace=false){
  	
    $attr = $this->getAttribute($name);
    
    $this->setAttribute($name,strip_tags($attr, '<b><i><p><a>'));
    parent::checkInput($name,$min_max);
  }

}

?>
